﻿using System;

namespace Ficharts.Net.Examples.Examples.Pies
{
    using Ficharts.Net.Enums;

    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.PieDemo.DataSource = new[]
                    {
                        new Data { label = "Nokia", value = "4.171" }, new Data { label = "Apple", value = "0.932" },
                        new Data { label = "Samsung", value = "3.294" }, new Data { label = "LG", value = "0.881" },
                        new Data { label = "ZTE", value = "0.661" }, new Data { label = "Others", value = "5.521" }
                    };
                this.PieDemo.ChartType = ChartType.Pie2D;
                this.PieDemo.DataBind();
            }
        }

        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            this.PieDemo.DataSource = new[]
                    {
                        new Data { label = "Samsung", value = "4.171" }, new Data { label = "Apple", value = "0.932" },
                        new Data { label = "Nokia", value = "3.294" }, new Data { label = "LG", value = "0.881" },
                        new Data { label = "ZTE", value = "0.661" }, new Data { label = "Others", value = "5.521" }
                    };
            this.PieDemo.ChartType = ChartType.Pie2D;
            this.PieDemo.DataBind();
        }
    }

    public class Data
    {
        public string label { get; set; }

        public string value { get; set; }
    }
}